import request from '@/utils/request'
export function exportPocourse(data) {
  request({
      method: 'get',
      url: '/api/file/export_po_course',
      params: data,
      responseType: 'blob',
      headers: {
          'Content-Type': 'application/json',
          'Authorization':"Bearer " + sessionStorage.getItem('token')
      }
  }).then((res) => {
      const link = document.createElement('a')
      let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
      link.style.display = 'none'
      link.href = URL.createObjectURL(blob)

      link.download = '课程进度管理.xls' //下载的文件名  注意：加.xls是兼容火狐浏览器
      document.body.appendChild(link)
      link.click()
      document.body.removeChild(link)
  }).catch(error => {
   
      console.log(error)
  })
}
export function exportCourseSupplier(data) {
    request({
        method: 'get',
        url: '/api/file/export_course_supplier',
        params: data,
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json',
            'Authorization':"Bearer " + sessionStorage.getItem('token')
        }
    }).then((res) => {
        const link = document.createElement('a')
        let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
        link.style.display = 'none'
        link.href = URL.createObjectURL(blob)
  
        link.download = '供应商分配总表.xls' //下载的文件名  注意：加.xls是兼容火狐浏览器
        document.body.appendChild(link)
        link.click()
        document.body.removeChild(link)
    }).catch(error => {
     
        console.log(error)
    })
  }
  
  export function exportWareHouse(data) {
    request({
        method: 'get',
        url: '/api/file/export_warehouse_receipt',
        params: data,
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json',
            'Authorization':"Bearer " + sessionStorage.getItem('token')
        }
    }).then((res) => {
        const link = document.createElement('a')
        let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
        link.style.display = 'none'
        link.href = URL.createObjectURL(blob)
  
        link.download = '供应商结算总表.xls' //下载的文件名  注意：加.xls是兼容火狐浏览器
        document.body.appendChild(link)
        link.click()
        document.body.removeChild(link)
    }).catch(error => {
     
        console.log(error)
    })
  }
  export function exportPo(data) {
    request({
        method: 'get',
        url: '/api/file/export_po',
        params: data,
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json',
            'Authorization':"Bearer " + sessionStorage.getItem('token')
        }
    }).then((res) => {
        const link = document.createElement('a')
        let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
        link.style.display = 'none'
        link.href = URL.createObjectURL(blob)
  
        link.download = 'po详情.xls' //下载的文件名  注意：加.xls是兼容火狐浏览器
        document.body.appendChild(link)
        link.click()
        document.body.removeChild(link)
    }).catch(error => {
     
        console.log(error)
    })
  }
//   

export function exportSupplierList(data) {
    request({
        method: 'get',
        url: '/api/file/export_supplier',
        params: data,
        responseType: 'blob',
        headers: {
            'Content-Type': 'application/json',
            'Authorization':"Bearer " + sessionStorage.getItem('token')
        }
    }).then((res) => {
        const link = document.createElement('a')
        let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
        link.style.display = 'none'
        link.href = URL.createObjectURL(blob)
  
        link.download = '供应商列表.xls' //下载的文件名  注意：加.xls是兼容火狐浏览器
        document.body.appendChild(link)
        link.click()
        document.body.removeChild(link)
    }).catch(error => {
     
        console.log(error)
    })
  }